#include"Info.h"
#include"TeleInfo.h"
#include<stdio.h>
#include<string.h>




bool IsNameEqual(void*p1,void*p2)
{
    Ren *r= (Ren*)p1;
    const char*str = (const char*)p2;
    return strcmp(r->Name,str) == 0;
}


bool IsNumEqual(void*p1,void*p2)
{
    Ren *r= (Ren*)p1;
    const char*str = (const char*)p2;
    return strcmp(r->Num,str) == 0;
}




void main()
{
    Tele t;
    InitTeleInfo(&t);
    char str[10] = {0};
    char a[2] = "1";
    
    printf("请问您是否要输入联系人和号码: 1代表是  ,  0代表否 \n");
    
    scanf("%s",str);
    
    if (strcmp(str,a) == 0)
    {
        char p1[16]={0};
        char p2[16]={0};
        printf("请输入您要添加的联系人姓名和号码: 姓名 号码\n");      
        scanf("%s %s",p1,p2);
        AddTeleInfo(&t,p1,p2);       
        PrintTeleInfo(&t);      
    }
    




    
    
    
    
    // //按照名字删除
    // RemoveTeleInfo(&t,"张三",IsNameEqual);
    
    // //按照号码删除
    // RemoveTeleInfo(&t,"1383838438",IsNumEqual);

    return;
}